import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
    //路由历史
    history:createWebHistory(),
    //配置路由,是一个数组，里面可以配置多个路由
    routes:[
        //摸版
/*      {
            //路由路径
            path:'/',
            //路由路径所对应的页面
            component : () => import(''),
        },
*/
        {
            path:'/CSSTest',
            component : () => import('../components/CssPage/LoadingView.vue'),
        },
        {
            path:'/',
            component : () => import('../components/LoginView.vue'),
        },
        {
            path:'/register',
            component : () => import('../components/RegisterView.vue'),
        },
        {
            path:'/home/:username',
            name: 'home',
            component : () => import('../components/HomePageView.vue'),
            props: true, // 将路由参数作为组件的 props 传入
        },
        {
            path:'/XM_verify915',
            component : () => import('../components/VerifyView.vue'),
        },
        {
            path:'/user/:user',
            name: 'user',
            component : () => import('../components/UserView.vue'),
            props: true, // 将路由参数作为组件的 props 传入
        },
        {
            path:'/test',
            component : () => import('../components/userService/TryView.vue')
        }
    ]
})

router.beforeEach((to, from, next) => {
    document.title = to.meta.title || 'M';
    next();
  });

export default router;